var activityModule = angular.module('activityModule', ['ngRoute']).
	controller('activityLoader', ['$routeParams', '$scope', '$http', function($routeParams, $scope, $http) {
		$scope.ambitoId = $routeParams.id;
		$scope.path = $scope.path + '->' + $routeParams.id;
		
		$scope.chat = 'Juancho: Cuándo es el parcial de Análisis II?\n' +	'Pepe: Creo que el 24/5';
		
		$scope.anotarse = function(){
			alert('Anotado');
		};		
		
		$scope.updateChat = function(){
			$scope.chat = $scope.chat + '\n' + 'Usuario: ' + $scope.message;
			$scope.message = '';
		};
		
		$http.get(urlBase + 'subambitos' + $scope.ambitoId).success(function(data) {
			$scope.subAmbitosElems = data;
		});				
		
		var wallInfo = {
				'id_ambito' : $scope.ambitoId,
				'id_muro' : 1,				
				'pagina' : 1				
		};
		
		$http.get(urlBase + 'communicationservice/showwall', wallInfo).success(function(data) {
				$scope.muroElems = data;
		});		
		
		var carteleraInfo = {
				'username' : 'juancho',
				'id_cartelera' : 1,				
				'id_ambito' : $scope.ambitoId
		};
		
		$http.get(urlBase + 'communicationservice/searchnewsbyuser', carteleraInfo).success(function(data) {
				$scope.carteleraElems = data;
		});
		
		$http.get('data/ambitos.json').success(function(data) {
			$scope.ambitos = data;
		});

		$http.get('data/actividades.json').success(function(data) {
			$scope.actividades = data;
		});		
	}])